﻿$.MGJ = {};
(function () {
    var _this = $.MGJ;
    $.extend($.MGJ, {
        APICall: function (param) {
            $.L.loadingIcon();
            var defaultParam = {
                url: $Config.apiUrl + param.url,
                data: param.data,
                crossDomain: true,
                type: param.type ? param.type : 'get',
                beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("Access-Token", $Config.token);
                },
                error: function (XMLHttpRequest, errorInfo, exception) {
                    $.L.loadingIconClose();
                    $.L.msgError("【" + XMLHttpRequest.status + "】【" + errorInfo + "】");
                },
                success: function (response) {
                    $.L.loadingIconClose();
                    var jsonObj = JSON.parse(response);
                    if (jsonObj.success == false) {
                        $.L.msgError(jsonObj.message)
                    } else {
                        if (param.success) {
                            param.success(jsonObj.result)
                        }
                    }
                }
            }
            $.ajax(defaultParam);
        },
        SaveHtmlToFile: function (GuidPath, Content) {

        }
    })
})(jQuery);
//定义TX
$.MGJ = {};
(function () {
    var _this = $.MGJ;
    $.extend($.MGJ, {
        APICall: function (param) {
            $.L.loadingIcon();
            var defaultParam = {
                url: $Config.apiUrl + param.url,
                data: param.data,
                crossDomain: true,
                type: param.type ? param.type : 'get',
                beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("Access-Token", $Config.token);
                },
                error: function (XMLHttpRequest, errorInfo, exception) {
                    $.L.loadingIconClose();
                    $.L.msgError("【" + XMLHttpRequest.status + "】【" + errorInfo + "】");
                },
                success: function (response) {
                    $.L.loadingIconClose();
                    var jsonObj = JSON.parse(response);
                    if (jsonObj.success == false) {
                        $.L.msgError(jsonObj.message)
                    } else {
                        if (param.success) {
                            param.success(jsonObj.result)
                        }
                    }
                }
            }
            $.ajax(defaultParam);

        },
        SaveHtmlToFile: function (GuidPath, Content) { }
    })
})(jQuery);
